/**
 * 
 */
package dao.product.impl;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import dao.product.ProductCateDao;

import util.GeneralDaoImpl;
import vo.UserVo;
import entity.Product;
import entity.ProductCate;


/**
 * @author Chigco.Orc
 *	商品类别
 */
@Transactional
public class ProductCateDaoImpl extends GeneralDaoImpl<java.lang.Long,ProductCate> implements ProductCateDao{
		public ProductCateDaoImpl(){
			super(entity.ProductCate.class);
		}
		/*
		 * 查找一级商品选项方法
		 */
		@Transactional
		public List<ProductCate> findProductCate() {
			return this.getHibernateTemplate().find("from ProductCate a where a.product.id is null");
//			System.out.println("ls:"+ls+"\tsize:"+ls.size());
//			if(ls.size() < 2){
//				return this.getHibernateTemplate().find("from ProductCate a where a.fatId = ?",Integer.valueOf(ls.get(0).toString()));
//			}else if(ls.size() > 1){
//				System.out.println("1:"+ls.get(0)+"\t2:"+ls.get(1));
//				return this.getHibernateTemplate().find("select a.name,b.name as sname from ProductCate as a,ProductCate as b where a.id = ? and b.id = ?",new Long[]{Long.valueOf(ls.get(0).toString()),Long.valueOf(ls.get(1).toString())});
//			}
//			return null;
		}
//		/*
//		 * 查找二级商品选项方法
//		 */
//		@Transactional
//		public List<ProductCate> findProductSecond(String id) {
//			return this.getHibernateTemplate().find("from ProductCate a where a.prodectId = ?",Integer.valueOf(id));
//		}
	
//		/*
//		 * 查找我发布的商品
//		 */
//		@Transactional
//		public List<Product> findMyProject(UserVo uVo) {
//			return this.getHibernateTemplate().find("from Product a where a.user.id = ?", uVo.getId());
//		}
	
}
